// pages/yuyue/yuyue.js
Page({

    /**
     * 页面的初始数据
     */
    data: {
        shop_list: [
            {
                img: 'http://img3.cache.netease.com/catchimg/20100926/89S0M189_0.jpg',
                name: '张姐的宠物店',
                wxID: '13333333333',
                phone: '13333333333'
            },
            {
                img: 'http://img3.cache.netease.com/catchimg/20100926/89S0M189_0.jpg',
                name: '老刘的宠物店',
                wxID: '13333333333',
                phone: '13333333333'
            },
            {
                img: 'http://img3.cache.netease.com/catchimg/20100926/89S0M189_0.jpg',
                name: '老刘的宠物店',
                wxID: '13333333333',
                phone: '13333333333'
            }
        ],
        shop_data: [
            {
                img: 'http://img3.cache.netease.com/catchimg/20100926/89S0M189_0.jpg',
                name: '驴子宠物',
                timeL: '60分钟',
                xxValue: 3,
                distance: '0.7km',
                wxID: '13333333333',
                phone: '13333333333'
            },
        ],
        actic: '',
        select: '',
        actic_show: false,
    },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function (options) {

    },

    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady: function () {

    },

    /**
     * 生命周期函数--监听页面显示
     */
    onShow: function () {

    },

    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide: function () {

    },

    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload: function () {

    },

    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh: function () {

    },

    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom: function () {

    },

    /**
     * 用户点击右上角分享
     */
    onShareAppMessage: function () {

    },
    onSearch: function (value) {
        wx.navigateTo({
            url: `../search/search?value=${value.detail}`
        })
    },
    select: function (index) {
        let that = this
        console.log(that.data.actic)
        that.setData({
            actic: index.currentTarget.dataset.index,
        })

        if (that.data.actic == '0') {
            that.setData({
                actic_show: true
            })
        } else {

            that.setData({
                select: '',
                actic_show: false
            })
        }
    },
    selects: function (index) {
        let that = this
        that.setData({
            select: index.currentTarget.dataset.index,
            actic_show: false
        })
    },
    //调电话
    Tel: function (phone) {
        wx.makePhoneCall({
            phoneNumber: phone.currentTarget.dataset.phone, //这个是我的手机号，模拟测试
            success: function () {
                console.log("拨打电话成功！")
            },
            fail: function () {
                console.log("拨打电话失败！")
            }
        })
    },
    //复制微信
    copyText: function (e) {
        wx.setClipboardData({
            data: e.currentTarget.dataset.wx,
            success: function (res) {
                wx.getClipboardData({
                    success: function (res) {
                        wx.showToast({
                            title: '复制成功'
                        })
                    }
                })
            }
        })
    },
    //跳预约
    goShare: function () {
        wx.navigateTo({
            url: `../share/share`
        })
    },
    //跳地图
    goMap:function(){
        wx.navigateTo({
            url: `../Map/Map`
        })
    }
})